package leetcode;

import java.util.ArrayList;
import java.util.List;

/**
 * 题目：90. 子集 II
 * 链接：https://leetcode.cn/problems/subsets-ii/description/
 * 思路：
 */
public class SubsetsWithDup {
    public static void main(String[] args) {
        int[] nums = {1,2,2};
        System.out.println(subsetsWithDup(nums));
    }
    public static List<List<Integer>> subsetsWithDup(int[] nums) {
        List<List<Integer>> res = new ArrayList<>();
        for (int i = 0; i < nums.length; i++) {
            List<Integer> list = new ArrayList<>();
            for (int j = i; j > 0; j--) {
                list.add(nums[j]);
            }
            if(!res.contains(list)){
                res.add(list);
            }
        }
        return res;
    }
}
